import asyncio
import os

from ai_core.asr.funasr.fun_asr import ASRModule
from ai_core.audio_format.opus import Opus_Encode
from ai_core.llm.chatglm import LLMModule
from ai_core.tts.edge import TTSModule
from ai_core.utils.factory.ai_factory import AIFactory
from ai_core.utils.util import Util

if __name__ == '__main__':
    config = Util.get_config()
    # llm = LLMModule(config.get('LLM').get('CHATGLM'))
    # res=llm.gen_response("你好呀,回答调皮些！")
    # print(res)
    # tts = TTSModule(config.get('TTS').get('EdgeTTS'))
    # output_file = asyncio.run(tts.text_to_speech(res,"test.wav"))
    # os.system(f"start {output_file}")

    factory = AIFactory(config)

    fun_asr=factory.create_asr_instance()
    encoder = Opus_Encode
    opus_data=encoder.load_opus_raw(output_path='test.opus')
    print(opus_data)



